#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>

#include "MSTK.h"


#ifdef __cplusplus
extern "C" {
#endif

int MESH_Surf_AttrPType(Mesh_ptr mesh) {
  int idx;
  MVertex_ptr local_mv;
  MEdge_ptr local_me;
  MFace_ptr local_mf;

  /* creat ptype attribute */
  MAttrib_ptr vertex_attrib = MAttrib_New(mesh,"Vertex_PType",INT,MVERTEX);
  MAttrib_ptr edge_attrib = MAttrib_New(mesh,"Edge_PType",INT,MEDGE);
  MAttrib_ptr face_attrib = MAttrib_New(mesh,"Face_PType",INT,MFACE);


  /* Mark all the vertex to be interior */
  idx = 0;
  while((local_mv = MESH_Next_Vertex(mesh,&idx))) 
    MEnt_Set_AttVal(local_mv,vertex_attrib,MV_PType(local_mv),0,NULL);
  idx = 0;
  while((local_me = MESH_Next_Edge(mesh,&idx))) 
    MEnt_Set_AttVal(local_me,edge_attrib,ME_PType(local_me),0,NULL);
  idx = 0;
  while((local_mf = MESH_Next_Face(mesh,&idx)))  
    MEnt_Set_AttVal(local_mf,face_attrib,MF_PType(local_mf),0,NULL);
  
  return 1;
}
  
#ifdef __cplusplus
}
#endif

